<template>
	<!-- 搜索 -->
	<view class="">
		<!-- 导航栏 -->
		<view class="searchBar">
			<image @click="goOne" class="img" src="../../static/左键.png"></image>
			<view class="searBar-box">
				<image src="../../static/搜索.png" mode="aspectFill" />
				<input type="text" v-model="usersay" placeholder="像艺术家一样生活" bindtap="toSearch" />
			</view>
			<text @click="sendUsersay" >搜索</text>
		</view>
		<hr>
		<view class="">
			<view class="record">
				<text>历史记录</text>
				<image src="../../static/删除.png" mode=""></image>
			</view>
			<view class="box2-2">
				<view class="" v-for="item in past">
					<text>{{item.num}}</text>
				</view>
			</view>
		</view>
		
		<!-- <view class="" v-if="showlist.length!=0">
			{{showlist}}
		</view> -->
		
		<view class="box2">
			<view class="box">
				<text>搜索发现</text>
				<view class="box-1" @click="sjData">
					<image src="../../static/换一批.png" mode=""></image>
					<text>换一换</text>
				</view>
			</view>
			<view class="box22">
				<view class="" v-for="item in search">
					<text>{{item.Text}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				usersay: "",
				search: [{
						Text: 'ins简约风美甲'
					},
					{
						Text: '有趣文案'
					},
					{
						Text: '夏日美甲'
					},
					{
						Text: '搞怪可爱头像'
					},
					{
						Text: '可爱图片'
					},
					{
						Text: '绘画临摹'
					},
				],
				search1: [{
						Text: '优质情侣头像'
					},
					{
						Text: 'lena卷发棒'
					},
					{
						Text: '毕业季赠言'
					},
					{
						Text: '卷发教程'
					},
					{
						Text: '水彩画花卉'
					},
					{
						Text: '有趣背景图'
					},

				],
				search2: [{
						Text: 'ur穿搭'
					},
					{
						Text: '毕业自我鉴定'
					},
					{
						Text: '有趣插图'
					},
					{
						Text: 'instagram背景图'
					},
					{
						Text: 'sankuan包'
					},
					{
						Text: '白敬亭壁纸'
					},
				],
				past:[
					{
						num:'吾禾'
					},
					{
						num:'夏日美甲'
					},
					{
						num:'简约风美甲'
					}
				],
				showlist:[
					
				]
			}
		},
		methods: {
			sendUsersay() {
				// let hava=[]
				// this.search.forEach((item,index)=>{
				// 	item.Text.indexOf(this.usersay)!=-1?this.showlist.push(item):""
				// })
				// console.log(this.showlist);

				this.past.unshift({
					num:this.usersay,
				})
			},
			sjData() {
				this.search = this.search1
				this.search1 = this.search2
				this.search2 = this.search
			},
			goOne() {
				uni.switchTab({
					url: "../index/index"
				})
			},
		}
	}
</script>


<style scoped lang="scss">
	@import "search.scss"
</style>
<style>
	page {
		background-color: #ffffff;
	}
</style>
